 <style>
 
.order_details{
	border:2px solid #daf3ff;
}
.order_details:hover{
	border:2px solid #afd9ff;
}
 </style>
 
	<div id="header">
		<div id="h_info">
			<a href="./index.php" class="title"><img src="<?php echo IMG_URL?>wdxy.png" /></a>
			<ul class="h_nav">
				<li><a href="http://127.0.0.1/xysc/xysc/index.php?r=order/order&user_id=<?php echo Yii::app()->user->id;?>">首页</a></li>
				<li><a href="./index.php?r=user/userinfo&user_id=<?php echo Yii::app()->user->id;?>">账户设置</a></li>
				<li><a href="#">消息</a></li>
			</ul>
			<div class="search" style="display:none"><input type="text" name="search" class="text" /><input type="submit" value="搜索" class="text submit"/></div>
		</div>
	</div>
	<div id="section">
		<div id="sidebar">
			<ul>
				<li class="change"><a href="#">我的交易</a>
					<ul>
						<li><a href="#" style="color:#000;font-size:12px;">我的购物车</a></li>
					</ul>
				</li>
				<li class="change"><a href="#" style="font-size:12px;">已买到的宝贝</a>
					<ul>
						<li><a href="#" style="color:#000;font-size:12px;">我的交易</a></li>
						<li><a href="#" style="color:#000;font-size:12px;">我的交易</a></li>
						<li><a href="#" style="color:#000;font-size:12px;">我的交易</a></li>
					</ul>
				</li>
				<li class="change"><a href="#">最近访问</a>
					<ul>
						<li><a href="#" style="color:#000;font-size:12px;">我的交易</a></li>
						<li><a href="#" style="color:#000;font-size:12px;">我的交易</a></li>
					</ul>
				</li>
			</ul>
		</div>
		<div id="main">
			<div class="title">
				<ul >
					<li class="underline_sel"><a href="#" style="color:#ff4401">所有订单</a></li>
					<li><a href="#">待付款</a></li>
					<li><a href="#">待发货</a></li>
					<li><a href="#">待收货</a></li>
					<li><a href="#">待评价</a></li>
				</ul>
				<div class="underline"></div>
				<div class="search">
					<input type="text" name="search_order"  placeholder ="输入商品标题或订单号进行搜索"  class="text" />
					<input type="submit" name="sub" value="订单搜索" class="submit" />
				</div>
			</div>
			<div class="order">
				<table>
					<tr style="border:1px solid #eee;">
						<th width="40%">商品名</th>
						<th width="10%">单价(元)</th>
						<th width="10%">数量</th>
						<th width="10%">店铺</th>
						<th width="10%">实付款</th>
						<th width="10%">
							<select name="statue_tra">
								<option id="0">交易状态</option>
								<option id="1">等待买家付款</option>
								<option id="2">付款确认中</option>
								<option id="3">买家已付款</option>
								<option id="4">买家已发货</option>
								<option id="5">交易成功</option>
								<option id="6">交易关闭</option>
								<option id="7">退款中的订单</option>
							</select>
						</th>
						<th width="10%" >交易操作</th>
					</tr>
				</table>
					
					<?php for($i=0;$i<count($order_nums);$i++){?>
					<table class="order_details">
					<tr class="dd_order">
						
						<td colspan="7"><h2><em><?php echo $order_nums[$i]['order_create_time'];?></em> 订单号： <?php echo $order_nums[$i]['order_no'];?><i><a style="margin-left:200px;" href="#">店名</a></i><img  src="<?php echo IMG_URL?>ywlx.png" style="cursor:pointer; position:relative;top:5px;margin-left:150px;"/></h2></td>
					</tr>
							<?php $_sql = "SELECT a.order_fee,a.order_status_id,a.goods_id,b.goods_name,b.goods_price,a.goods_nums,a.order_no,(SELECT e.brand_name FROM {{brand}} e WHERE e.brand_id=b.brand_id) as brand_name,b.goods_thumbnail_url,(SELECT d.express_fee FROM {{express}} d WHERE d.express_id=c.express_id) as express_fee,(SELECT f.order_status_name FROM {{order_status}} f WHERE f.order_status =a.order_status_id) as order_status  FROM {{order_details}} a,{{goods}} b,{{order}} c  WHERE a.goods_id=b.goods_id AND a.order_no=c.order_no AND  a.order_no='".$order_nums[$i]['order_no']."'";?>
							<?php if($order_nums[$i]['order_nums'] > 1){?>
							<?php 
								$cccmodel = new CCCModel();
								$goods_info = $cccmodel -> sel($_sql);
								foreach($goods_info as $_v){
								?>
							<tr class="dd_info">
								<td style="width:520px;">
									<div class="order_list">
									<a href="./index.php?r=goods/details&_goods_id=<?php echo $_v['goods_id']?>"><img width="78" height="79" src="<?php echo $_v['goods_thumbnail_url'];?>" /></a>
									<a href="./index.php?r=goods/details&_goods_id=<?php echo $_v['goods_id']?>"><?php echo $_v['goods_name']?></a><a href="#">[交易快照]</a>
									<p style="color:#9c9c9c">颜色分类：USB有线网卡-普通版</p>
									</div>
								</td>
								<td  class="text_posi" style="color:#000;"><p><?php echo sprintf("%.2f",$_v['goods_price'],2);?></p></td>
								<td  class="text_posi"><p><?php echo $_v['goods_nums'];?></p></td>
								<td  class="text_posi">
									<p><a href="#"><?php echo $_v['brand_name'];?></a></p>
									<p><a href="#">退款/退货</a></p>
								</td>
								<td  class="text_posi">
									<p><?php echo sprintf("%.2f",($_v['order_fee']+$_v['express_fee']))?></p>
									<p>(含运费:<?php echo $_v['express_fee'];?>)</p>
									</td>
								<td  class="text_posi">
									<p><a href="#" <?php if($_v['order_status_id'] == 5) echo "style='color:red'"; ?>><?php echo $_v['order_status'];?></a></p>
									<p><a href="./index.php?r=eva/eva&goods_id=<?php echo $_v['goods_id']?>&order_no=<?php echo $_v['order_no']?>">订单详情</a></p>
									<p><a href="#">查看物流</a></p>
								</td>
								<td  class="text_posi">
									<p><input type="button" name="btn" <?php if($_v['order_status'] == '等待付款'){echo 'value="立即支付"';}else{echo 'style="display:none"';}?>   onclick="window.location.href='./index.php?r=order/pay&order_no=<?php echo $_v['order_no'];?>&goods_id=<?php echo $_v['goods_id'];?>&price=<?php echo $_v['order_fee']+$_v['express_fee'];?>'" class="btn"/></p>
									<p <?php if($_v['order_status_id'] == 5 || $_v['order_status_id'] == 3 || $_v['order_status_id'] == 4) echo 'style="display:none"'?>>还剩<?php echo floor((604800-(time()-strtotime($order_nums[$i]['order_create_time'])))/60/60/24); ?>天</p>
									<p><a onclick="return confirm('确定取消订单吗?');" href="./index.php?r=order/ordercancel&order_no=<?php echo $_v['order_no'];?>&goods_id=<?php echo $_v['goods_id']; ?>" <?php if($_v['order_status_id'] != 6) echo 'style="display:none"'?>>取消订单</a></p>
								<p <?php if($_v['order_status'] != '交易成功') echo 'style="display:none"';?>><input type="button"   name="btn"   class="btn" value="立即评价" onclick="window.location.href='./index.php?r=eva/eva&goods_id=<?php echo $_v['goods_id'];?>&order_no=<?php echo $_v['order_no'];?>" /></p>
									
								</td>
							</tr>
							<?php }}else{
								$cccmodel = new CCCModel();
								$goods_info = $cccmodel -> sel($_sql);
								?>
								<tr class="dd_info">
								<td  style="width:540px;">
									<div class="order_list">
									<a href="./index.php?r=goods/details&_goods_id=<?php echo $goods_info['0']['goods_id']?>"><img width="78" height="79" src="<?php echo $goods_info['0']['goods_thumbnail_url']?>" /></a>
									<a href="./index.php?r=goods/details&_goods_id=<?php echo $goods_info['0']['goods_id']?>" ><?php echo $goods_info['0']['goods_name']?></a><a href="#">[交易快照]</a>
									<p style="color:#9c9c9c">颜色分类：USB有线网卡-普通版</p>
									</div>
								</td>
								<td  class="text_posi" style="color:#000"><p><?php echo $goods_info['0']['goods_price']?></p></td>
								<td  class="text_posi"><p><?php echo $goods_info['0']['goods_nums']?></p></td>
								<td  class="text_posi">
									<p><a href="#"><?php echo $goods_info['0']['brand_name']?></a></p>
									<p><a href="#">退款/退货</a></p>
								</td>
								<td  class="text_posi">
									<p><?php echo sprintf("%.2f",$goods_info[0]['order_fee']+$goods_info[0]['express_fee'])?></p>
									<p>(含运费:<?php echo $goods_info[0]['express_fee'];?>)</p>
									</td>
								<td  class="text_posi">
									<p><a href="#"  <?php if($goods_info[0]['order_status_id'] == 5) echo "style='color:red'"; ?>><?php echo $goods_info[0]['order_status'];?></a></p>
									<p><a href="./index.php?r=eva/eva&goods_id=<?php echo $goods_info[0]['goods_id']?>&order_no=<?php echo $goods_info[0]['order_no']?>">订单详情</a></p>
									<p><a href="#">查看物流</a></p>
								</td>
								<td  class="text_posi">
									<p><input type="button"  name="btn"   class="btn" <?php if($goods_info[0]['order_status'] == '等待付款'){echo 'value="立即支付"';}else{echo 'style="display:none"';}?> onclick="window.location.href='./index.php?r=order/pay&order_no=<?php echo $goods_info[0]['order_no'];?>&goods_id=<?php echo $goods_info[0]['goods_id'];?>&price=<?php echo $goods_info['0']['order_fee']+$goods_info[0]['express_fee'];?>'" /></p>
									<p <?php if($goods_info['0']['order_status_id'] == 5 || $goods_info['0']['order_status_id'] == 3 || $goods_info['0']['order_status_id'] == 4) echo 'style="display:none"'?>>还剩<?php echo floor((604800-(time()-strtotime($order_nums[$i]['order_create_time'])))/60/60/24); ?>天</p>
									<p><a onclick="return confirm('确定取消订单吗?');" href="./index.php?r=order/ordercancel&order_no=<?php echo $goods_info['0']['order_no'];?>&goods_id=<?php echo $goods_info['0']['goods_id']; ?>" <?php if($goods_info['0']['order_status_id'] != 6) echo 'style="display:none"'?>>取消订单</a></p>
									
									<p <?php if($goods_info[0]['order_status'] != '交易成功') echo 'style="display:none"';?>><input type="button"   name="btn" onclick="window.location.href='./index.php?r=eva/eva&goods_id=<?php echo $goods_info[0]['goods_id'];?>&order_no=<?php echo $goods_info[0]['order_no'];?>'"   class="btn" value="立即评价"  /></p>
									
								</td>
							</tr>
							<?php }?>
					</table>
					<?php }?>
					
			</div>
		</div>	
	</div>
	